package model.commands.math;

import java.util.List;
import java.util.Random;
import model.Environment;
import model.SyntaxErrorException;
import model.commands.Command;


/**
 * Name:
 * RANDOM max
 * 
 * Description:
 * returns random non-negative integer strictly less than max
 * 
 * @author JLongley
 * @author Erick Gonzalez
 */

public class RandomCommand extends Command {

    @Override
    public int evaluate(Environment e) throws SyntaxErrorException {
        List<Command> myArguments = getArguments();
        int max = myArguments.get(0).evaluate(e);
        Random generator = new Random();
        return generator.nextInt(max);
    }
}
